﻿import 'package:bot_toast/bot_toast.dart';
import 'package:fluent_ui/fluent_ui.dart' as fluent;
import 'package:flutter/material.dart';

mixin PageMixin {
  Widget subtitle({required Widget content}) {
    return Builder(builder: (context) {
      return Padding(
        padding: const EdgeInsetsDirectional.only(top: 14.0, bottom: 2.0),
        child: DefaultTextStyle(
          style: fluent.FluentTheme.of(context).typography.subtitle!,
          child: content,
        ),
      );
    });
  }

  void infomationMessage(String msg) {
    BotToast.showCustomText(
      onlyOne: true,
      duration: const Duration(seconds: 3),
        toastBuilder: (_) => Align(
              alignment: Alignment.topCenter,
              child: Card(
                child: Padding(
                  padding: const EdgeInsets.all(5),
                  child: Row(
                    mainAxisSize: MainAxisSize.min,
                    children: [
                      const SizedBox(width: 20,),
                      const Icon(
                        fluent.FluentIcons.info,
                        size: 20,
                        color: Colors.green,
                      ),
                      const SizedBox(
                        width: 10,
                      ),
                      Text(
                        msg,
                        style:
                            const TextStyle(fontSize: 16, color: Color(0xff171717)),
                      ),
                      const SizedBox(width: 20,),
                    ],
                  ),
                ),
              ),
            ));
  }

}
